package com.youi.service.impl;


import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.youi.dao.BaseDao;
import com.youi.service.BaseService;

@Service
public abstract class BaseServiceImpl<T> implements BaseService<T>{
	
	private BaseDao<T> baseDAO;
	
	public void setBaseDAO(BaseDao<T> baseDAO) {
		this.baseDAO = baseDAO;
	}

	public T get(Long id) {
		return (T) baseDAO.get(id);
	}
	
	public void saveOrUpdate(T t) {
		baseDAO.saveOrUpdate(t);
	}
	
	public void saveOrUpdateAll(List<T> t){
		baseDAO.saveOrUpdateAll(t);
	}
	
	
	public void delete(T t){
		baseDAO.delete(t);
	}
	
	public void delById(Long id){
		baseDAO.delById(id);
	}


	public void deleteAll(List<T> t){
		baseDAO.deleteAll(t);
	}
	
	
	public T getByParam(Map<String, Object> params){
		return baseDAO.getObject(params);
	}
	
	public List<T> getByParams(Map<String, Object> params){
		return baseDAO.getObjectList(params);
	}
	
	public T getByParam(Map<String, Object> params,Map<String, Object> searchParams,Map<String, Object> sortParams){
		return baseDAO.getByParam(params,searchParams,sortParams);
	}
	
	
	public List<T> getByParams(Map<String, Object> params, Map<String, Object> searchParams,Map<String, Object> sortParams){
		return baseDAO.getByParams(params,searchParams, sortParams);
	}
	

	public T getByParamss(Map<String, Object> params,Map<String, Object> searchParams,Map<String, Object> sortParams,
			Map<String, Object>  gtParams,Map<String, Object> ltParams){
		return baseDAO.getByParamss(params, searchParams, sortParams, gtParams, ltParams);
	}
	
	public List<T> getByParamsList(Map<String, Object> params,Map<String, Object> searchParams,Map<String, Object> sortParams,
			Integer pageIndex, Integer pageNum,Map<String, Object>  gtParams,Map<String, Object> ltParams){
		return baseDAO.getByParamsList(params, searchParams, sortParams, pageIndex, pageNum, gtParams, ltParams);
	}
	public List<T>  getByParamsAll(Map<String, Object> params,Map<String, Object> searchParams,Map<String, Object> sortParams,
			Map<String, Object>  gtParams,Map<String, Object> ltParams){
		return baseDAO.getByParamsAll(params, searchParams, sortParams, gtParams, ltParams);
	}
	
	public Integer  getCount(Map<String, Object> params){
		return baseDAO.getCount(params);
	}
	
	public Integer  getCountByParams(Map<String, Object> params, Map<String, Object> searchParams){
		return baseDAO.getCountByParams(params, searchParams);
	}
	public Integer  getCountByParamss(Map<String, Object> params,Map<String, Object> searchParams,
			Map<String, Object>  gtParams,Map<String, Object> ltParams){
		return baseDAO.getCountByParamss(params, searchParams, gtParams, ltParams);
	}

}
